<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <title></title>
</head>
<body>
<!--弹窗：收入分配-->
<div th:fragment="budgetinDistributionEdit" class="modal inmodal fade" id="budgetincomeDistributionEdit_Modal"
     tabindex="-1" role="dialog" aria-hidden="true" data-backdrop="static">
    <div class="modal-dialog modal-lg">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span
                        class="sr-only">Close</span></button>
                <h4 class="modal-title" id="budgetincomeDistributionEdit_modalTitle">收入分配</h4>
                <p id="budgetincomeDistributionEdit_modalDesc" class="font-bold text-danger"></p>
            </div>
            <div class="modal-body">

            </div>

            <div class="modal-footer">
                <button type="button" class="btn btn-white" data-dismiss="modal">关闭</button>
                <button type="button" class="btn btn-primary" onclick="budgetincomeDistributionEditObj.submitHandler()">
                    保存
                </button>
            </div>
        </div>
    </div>
    <script type="text/javascript">
        $(function () {

        })
        var budgetincomeDistributionEditObj = new Object({
            myModal: $('#budgetincomeDistributionEdit_Modal'),
            init: function (id) {
                budgetincomeDistributionEditObj.myModal.modal('show');
            },
            submitHandler: function () {
                budgetincomeDistributionEditObj.myForm.submit();
            },
            dataFormSubmit: function (form) {
                let _self = this;
                let formVals = $(form).serializeArray();
                let data = {}
                for (let i = 0; i < formVals.length; i++) {
                    data[formVals[i].name] = formVals[i].value;
                }
                $.myPost({
                    url: `/budget/budgetincome/${data.id ? 'update' : 'save'}`,
                    dataType: 'json',
                    data: data,
                    success: function (data) {
                        if (data && data.code == 0) {
                            toastr.success(data.msg, '操作提示')
                            _self.myModal.modal('hide')
                            budgetincomeListObj.refreshDataList();
                        } else {
                            toastr.error(data.msg, '操作失败')
                        }
                    }
                })
            }
        })
    </script>

</div>
</body>
</html>